*---------------------------------------------------------------------------------------------------*
Create Transmissibility Multiplier Grid Property
Author: Gavin Henry Graham
Date: 11/01/2014

This is a research code and it is hoped that it will be useful. However, the author does not accept 
any responsibility to anyone for the consequences of using the code.
*---------------------------------------------------------------------------------------------------*

Copyright Declaration

The copyright of the code "Create Transmissibility Multiplier Grid Property" rests with the author 
and is made available under a Creative Commons Attribution Non-Commercial No Derivatives licence. 
Researchers are free to copy, distribute or transmit the code on the condition that they attribute it, 
that they do not use it for commercial purposes and that they do not alter, transform or build upon it. 
For any reuse or redistribution, researchers must make clear to others the licence terms of this work.

*---------------------------------------------------------------------------------------------------*

Code Description

This code has been developed to take the barrier-covered Heterogeneity Surfaces generated by the 
clinoform-modelling algorithm and translate them into a transmissibility multiplier grid property 
in x, y, and/or z directions, depending on the orientation of the heterogeneity surface for use in
flow simulation. The transmissibility multiplier is modified for cells in the grid layer above the 
Heterogeneity Surface. Grid cells are assigned a transmissibility multiplier of 1 and are open to 
flow where no Heterogeneity Surface is present, whereas grid cells are assigned a transmissibility
multiplier of 0 and act as a barrier to flow if a Heterogeneity Surface is present (e.g. Fig. 3.6C, 
D on p. 119 of the thesis). More details on this method can be found in Section 3.7.3 (p. 118 of the 
thesis)

NOTE: This method assumes that the resolution of the grid in x- and y- directions is the same as the 
resolution of the Heterogeneity Surfaces in the equivalent directons

Inputs: 
	
	1. File paths (including file name) for the Bounding Surfaces that were used in the clinoform 
	   modelling algorithm in zmap+ file format
	   (e.g. C:\Users\Imperial\Desktop\f1.5.zmap+ - see example inputs)

	2. File path (including file name) to import the Heterogeneity Surface Information file.
	   This file contains 4 lines:
		1. The first line has one field that contains the null data value as it is found in the 
		   Bounding Surfaces, Clinoform Surfaces and Heterogeneity Surfaces in zmap+ format 
		2. The second line has six fields that from left to right are: the minimum grid X node 
		   value (usually a UTM coordinate); the maximum grid X node value (usually a UTM 
		   coordinate); the minimum grid Y node value (usually a UTM coordinate); the maximum
		   grid Y node value (usually a UTM coordinate); the maximum depth of the model; 
	           the minimum depth of the model.
	        3. The third line has two fields. The first field is the  number of columns 
	           in the grid (number of nodes in the x-direction). The second field is the number 
		   of rows in the grid (number of nodes in the y-direction).
		4. The fourth line has one field that contains the number of Heterogeneity Surfaces to 
		   be used to create the grid properties.
       	   An example of this file is provided with the code
	   (e.g C:\Users\Imperial\Desktop\Heterogeneity-Surface-Information.txt - see example inputs)

	3. The file path where the unmodfied Heterogeneity Surfaces can be found
	   (e.g C:\Users\Imperial\Desktop\ )

	4. File path (including file name) to import the Grid Information file.
	   The number of lines in this file varies with the number of Heterogeneity Surfaces.
		1. The first line has one field which contains the number of zones in the grid and is 
		   equivalent to the number of Heterogeneity Surfaces in the Heterogeneity Surface
		   Information file.
		2. The second line also has one field that contains the total number of layers in the
		   grid.
		3. The third line has two fields. The first is the number of grid cells in the x-
		   direction and the second is the number of grid cells in the y-direction.
		4. The number of additional lines depends on the number of Heterogeneity Surfaces.
                   These values correpsond to the grid layer directly above the adjacent 
		   Heterogeneity Surface. For example, the first grid layer value corresponds 
                   to the layer directly adjacent to Heterogeneity Surface 1. This information is
                   used when creating a transmissibility multiplier grid property for the z-
	           direction. 
	   An example of this file is provided with the code
	  (e.g C:\Users\Imperial\Desktop\Grid-Information.txt - see example inputs)

	5. File path (including file name) to import the Top Grid Layers Information file. In the 
	   thesis, the grid conformed to the clinoform surfaces. However, an extra layer of cells
           were created using a proportional gridding method conditioned to the Top Bounding Surface 
	   and an additional dummy surface that increased the depth of the Top Bounding Surface 
	   by the thickness of a single layer of cells in the model. This was done to allow pinched 
	   out cells near the top of the model to have an adjacent face in which to allow flow, to 
	   reduce the numerical errors in simulation.
	   This file contains the unique layer number in the grid that corresponds to the extra 
	   layer of cells at the top of the grid. This will be in almost all cases grid layer 1. 
           This information along with the Heterogeneity Surfaces are used to create 
           transmissibility multiplier grid properties for the x- and y-directions. An example 
           file is provided with this code
	   (e.g C:\Users\Imperial\Desktop\Top-Grid-Layers-Information.txt - see example inputs)

	6. File path (including file name) to import the Base Grid Layers Information file. 
	   Equivalent to input number 5, but for the extra layer of cells at the base of the 
           grid. This layer of cells was necessary when modelling multiple stacked parasequences 
           and ensures there are no pinched out cells immediately adjacent to the parasequence 
	   boundaries. An example file is provided with this code
	   (e.g C:\Users\Imperial\Desktop\Base-Grid-Layers-Information.txt - see example inputs)

	7. The file path where the grid properties are to be exported
	   (e.g C:\Users\Imperial\Desktop\ )
		
Outputs:
	
	1. 3 transmissibility multiplier grid property files, one each for the x-, y- and z- 
	   directions. Each file contains the appropriate eclipse keyword (e.g. MULTZ) and 
           Header information and is suitbale to be used directly with the grid for simulations
           or imported into reservoir modelling software packages for inspection. 
	   The format of the output files is .GRDECL
	